<%@include file="/header.jsp"%>
<%@ page language="java" contentType="text/html" %>
<%@ page import="dataGateway.UserTable" %>

<%
	String username = request.getParameter("username");
	String passwd = request.getParameter("passwd");
	
	int check = UserTable.getInstance().userCheck(username, passwd);
	
	if(check== -1) {
%>
		<script>
		alert("No ID exists!");	
		history.back();
		</script>
	<%
	} else if(check==0) {
	%>
		<script>
			alert("Wrong Password!");	
			history.back();
		</script>
		
	<%
	} else {
		session.setAttribute("username", username);
		out.println(common.JspUtil.makeErrorMsg("Welcome, "+username, common.JspUtil.URL_DEFAULT));
	}
%>
<%@include file="/footer.jsp"%>